package com.nbsaas.boot.manufacturing.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "工艺路线", model = "工艺路线")
@Entity
@Table(name = "bs_process_route")
@Comment("工艺路线表")
public class ProcessRoute extends AbstractEntity {

    @Comment("路线编号")
    @SearchItem(name = "routeNo", key = "routeNo", label = "路线编号")
    @FormField(title = "路线编号", sortNum = "1", grid = true, required = true)
    @Column(length = 50, nullable = false, unique = true)
    private String routeNo;

    @Comment("路线名称")
    @SearchItem(name = "name", key = "name", label = "路线名称")
    @FormField(title = "路线名称", sortNum = "2", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String name;

    @Comment("产品ID")
    @FormField(title = "产品", sortNum = "3", grid = true, type = InputType.select, required = true)
    private Long productId;

    @Comment("产品SKU ID")
    @FormField(title = "产品SKU", sortNum = "4", grid = true, type = InputType.select)
    private Long productSkuId;

    @Comment("路线版本")
    @FormField(title = "路线版本", sortNum = "5", grid = true)
    @Column(length = 20)
    private String version;

    @Comment("路线描述")
    @FormField(title = "路线描述", sortNum = "6", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String description;

    @Comment("标准工时(分钟)")
    @FormField(title = "标准工时(分钟)", sortNum = "7", grid = true, type = InputType.el_input_number)
    private Integer standardTime;

    @Comment("标准成本")
    @FormField(title = "标准成本", sortNum = "8", grid = true, type = InputType.el_input_number)
    @Column(precision = 10, scale = 2)
    private BigDecimal standardCost;

    @Comment("路线状态")
    @FormField(title = "路线状态", sortNum = "9", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // DRAFT-草稿, ACTIVE-启用, INACTIVE-停用

    @Comment("是否默认")
    @FormField(title = "是否默认", sortNum = "10", grid = true, type = InputType.select)
    private Boolean isDefault;

    @Comment("生效日期")
    @FormField(title = "生效日期", sortNum = "11", type = InputType.date, grid = true)
    private java.util.Date effectiveDate;

    @Comment("失效日期")
    @FormField(title = "失效日期", sortNum = "12", type = InputType.date, grid = true)
    private java.util.Date expiryDate;

    @Comment("工艺要求")
    @FormField(title = "工艺要求", sortNum = "13", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String processRequirements;

    @Comment("质量要求")
    @FormField(title = "质量要求", sortNum = "14", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String qualityRequirements;

    @Comment("安全要求")
    @FormField(title = "安全要求", sortNum = "15", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String safetyRequirements;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "16", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String note;

    @Comment("审核状态")
    @FormField(title = "审核状态", sortNum = "17", grid = true, type = InputType.select)
    @Column(length = 20)
    private String auditStatus; // PENDING-待审核, APPROVED-已审核, REJECTED-已拒绝

    @Comment("审核人")
    @FormField(title = "审核人", sortNum = "18", grid = true)
    private Long auditor;

    @Comment("审核时间")
    @FormField(title = "审核时间", sortNum = "19", type = InputType.date, grid = true)
    private java.util.Date auditTime;

    @Comment("审核意见")
    @FormField(title = "审核意见", sortNum = "20", type = InputType.richText, col = 23)
    @Column(length = 1000)
    private String auditOpinion;
} 